var $id;
var ready = false;

function init($identity) {
	$id = $identity;
}

function talk($cmd) {
	if(ready) 
	{
		var jqxhr = $.ajax("http://localhost/dream-world/memory-world/source/backend/a.php", {
			data: {cmd: $cmd, id: $id },
			contentType : 'application/json',
			type : 'POST'
		});
		
		jqxhr.done(function(data) {
			// Post is coming back
			alert(data.valid);
		});
	}
}

function animate() {
}

// On Ready
$(function() {
	ready = true;
});